<?php
//这是用户操作模块

class member extends spController
{
	function __construct(){ // 公用
		parent::__construct(); // 这是必须的
		$this->tpl_title = "用户模块|主题部分";
	}
	
	function index(){ // 这里是首页
		$this->contents = "用户模块首页内容";
		$this->display("member/main_index.html");
	}
	function addsite()
	{
		$this->contents = "添加网站";
		$this->display("member/main_add.html");
	}
	function insert()
	{
		  $data = $this->spArgs(); 
		  $Model = spClass('site');

		  $data['userid']=$_SESSION["userinfo"]["userid"];
		  $data['groupid']='1';
          $data['addtime']=strtotime(date("Y-m-d H:i:s"));
          $data['lasttime']=strtotime(date("Y-m-d H:i:s"));
//          $data['site_ip']=$ip;
          if($Model->create($data))
          {
          	echo '添加成功';
          } 
	}
	
	function site()
	{
		$record=spClass('site');
		$conditions= array
		(
			"userid" => $_SESSION["userinfo"]["userid"],
		);
		$list = $record->findall($conditions);

		$this->list=$list;
		$this->display("member/main_site.html");
	}
	
	function edit()
	{
		
	}
	
	function record()
	{
		$siteid = $this->spArgs('siteid');
		$web_title = $this->spArgs("title");
		$web_domain = $this->spArgs("domain");
		
		$conditions['siteid'] = $siteid;							
		$record = spClass('record');	
		$this->results = $record->spPager($this->spArgs('page', 1), 10)->findAll($conditions); 		
		$this->pager = $record->spPager()->getPager();
		
		$this->keyword=$siteid;
		$this->siteid=$siteid;
		$this->web_title=$web_title;
		$this->web_domain = $web_domain;
		$this->contents = "网站检测记录详情";
		$this->display("member/main_record.html");
		
	}
	
	function nrecord()
	{	
		$siteid = $this->spArgs('keyword');
		$web_title = $this->spArgs("title");
		$web_domain = $this->spArgs("domain");
		
		$conditions['siteid'] = $siteid;						
		$record = spClass('record');
		$this->results = $record->spPager($this->spArgs('page', 1), 10)->findAll($conditions); 		
		$this->pager = $record->spPager()->getPager();		

		$this->keyword=$siteid;
		$this->web_title=$web_title;
		$this->web_domain = $web_domain;
		$this->contents = "网站检测记录详情";
		$this->display("member/main_record.html");
		
	}
	
}	